0%

python云服务器配置

VScode Remote

今天抱着不想上班的心情迎来了高温假后的第一个工作日,吭哧吭哧本地装好了python2 发现没有我需要的包,我还只能在服务器上用那个只有linux和OS的软件。。。

折腾了一波 vscode的remote-ssh,妈蛋服务器端下载又不行

挂上了wget的代理

1
2
3
4
5
$cat ~/.wgetrc
use_proxy=on
#check-certificate=off
http_proxy=http://127.0.0.1:9293
https_proxy=http://127.0.0.1:9293

之后,是能下载了,但是centos6的基本库又有问题,我来更新它的权限不是很够,还有gcc的版本要调,由于工程太过浩大,鸽。。。

emmm centos6安装了依赖包之后,蜜汁可以了,非常佛

1
2
3
4
5
6
7
8
9
10
11
12
13
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-common-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-devel-2.17-55.el6.x86_64.rpm
wget http://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-headers-2.17-55.el6.x86_64.rpm
wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-utils-2.17-55.el6.x86_64.rpm
wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/glibc-static-2.17-55.el6.x86_64.rpm

wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/gcc-4.8.2-16.3.fc20/libstdc++-4.8.2-16.3.el6.x86_64.rpm
wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/gcc-4.8.2-16.3.fc20/libstdc++-devel-4.8.2-16.3.el6.x86_64.rpm
wget https://copr-be.cloud.fedoraproject.org/results/mosquito/myrepo-el6/epel-6-x86_64/gcc-4.8.2-16.3.fc20/libstdc++-static-4.8.2-16.3.el6.x86_64.rpm

sudo rpm -Uh --force --nodeps glibc-2.17-55.el6.x86_64.rpm glibc-common-2.17-55.el6.x86_64.rpm glibc-devel-2.17-55.el6.x86_64.rpm glibc-headers-2.17-55.el6.x86_64.rpm glibc-static-2.17-55.el6.x86_64.rpm glibc-utils-2.17-55.el6.x86_64.rpm
sudo rpm -Uh libstdc++-4.8.2-16.3.el6.x86_64.rpm libstdc++-devel-4.8.2-16.3.el6.x86_64.rpm libstdc++-static-4.8.2-16.3.el6.x86_64.rpm

然后就可以体验vscode的远程界面了

在服务器上也安装好相关需要的插件

vscode remote非常迷,达到了一个ssh终端的效果,我把图片拖上去也能使用,非常棒。。。

jupter notebook 云服务器配置服务器

我决定再来折腾一波jupter notebook的云服务器配置,智障的我一开始配的是jupter python3,导致改成python2的jupyter再配置好启动就冒了一串这个玩意:

`HTTP request sent; waiting for response.[I 14:21:23.131 NotebookApp] Accepting one-time-token-authenticated connection from ::1

localhost cookie: _xsrf=2|6c33e61b|1db145affcf3b3a4ad8ed3d9c660e009|1564640483 Allow? (Y/N/Always/neVer)`狂按一波delete之后好了。。。emmm,就酱

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$jupyter notebook --generate-config

In [1]: from IPython.lib import passwd

In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:9c54a45da8d5:7097820a8e516d2d2698061e2bc4f843d204936a'

$vim ~/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip='*' #所有绑定服务器的IP都能访问,若想只在特定ip访问,输入ip地址即可
c.NotebookApp.notebook_dir = '/NFS/cany/jupyter_projects'
c.NotebookApp.password = u'sha1:9c54a45da8d5:7097820a8e516d2d2698061e2bc4f843d204936a'
c.NotebookApp.open_browser = False # 代表启动notebook服务时不打开浏览器并访问
c.NotebookApp.port =8888 #随便指定一个端口
c.IPKernelApp.pylab = 'inline'




#在服务器端启动jupyter notebook
jupyter notebook --no-browser

#将远程服务器8888端口指定到本地8889端口
ssh -T -L 8889:localhost:8888 TAD

#在chrome中输入http://localhost:8889/tree
第一次登录的时候会要求输入密码吼吼

1570605051706

jupyter notebook 拓展

https://zhuanlan.zhihu.com/p/36389916

1
2
3
4
pip3 install jupyter_nbextensions_configurator --user
pip3 install jupyter_contrib_nbextensions --user
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user

1570605066407